package com.cms.template.directive;

import java.util.List;

import com.cms.TemplateVariable;
import com.cms.entity.Category;
import com.jfinal.template.Env;
import com.jfinal.template.io.Writer;
import com.jfinal.template.stat.Scope;

@TemplateVariable(name = "header")
public class HeaderDirective extends BaseDirective{
	 public void exec(Env env, Scope scope,Writer writer) {
	        scope = new Scope(scope);
	        String id = this.getParameter("id", String.class, scope);
	        List<Category> category = new Category().find("select * from cms_category where parentId = ?",id);
	        scope.setLocal("categorys",category);
	        stat.exec(env, scope, writer);
	    }
	  public boolean hasEnd() {
	        return true;
	    }	
}
